<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Editable TreeGrid - jQuery EasyUI Demo</title>
	<base href="<%=basePath%>">
	<link rel="stylesheet" type="text/css" href="../jquery-easyui-1.2.5/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../jquery-easyui-1.2.5/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../jquery-easyui-1.2.5/demo/demo.css">
	<script type="text/javascript" src="../jquery-easyui-1.2.5/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="../jquery-easyui-1.2.5/jquery.easyui.min.js"></script>
	<script>
		function editNode(){
			var node = $('#tt').treegrid('getSelected');
			if (node){
				$('#tt').treegrid('beginEdit',node.id);
			}
		}
		function saveNode(){
			var node = $('#tt').treegrid('getSelected');
			if (node){
				$('#tt').treegrid('endEdit',node.id);
			}
		}
		function cancelNode(){
			var node = $('#tt').treegrid('getSelected');
			if (node){
				$('#tt').treegrid('cancelEdit',node.id);
			}
		}
	</script>
</head>
<body>
	<h2>Editable TreeGrid - Pagination</h2>
	<div class="demo-info">
		<div class="demo-tip icon-tip"></div>
		<div>Select node and Click edit button to perform editing.</div>
	</div>
	
	<div style="margin:10px 0">
		<a href="javascript:editNode()" class="easyui-linkbutton">Edit</a>
		<a href="javascript:saveNode()" class="easyui-linkbutton">Save</a>
		<a href="javascript:cancelNode()" class="easyui-linkbutton">Cancel</a>
	</div>
	
	<table id="tt" title="TreeGrid" class="easyui-treegrid" style="width:700px;height:300px"
			url="sys/queryAllMenu.action" idField="id" treeField="code"
			pagination="true" fitColumns="true">
		<thead>
			<tr>
				<th field="menuid" rowspan="2" width="150" editor="text">menuid</th>
				<th colspan="3">Group Fields</th>
			</tr>
			<tr>
				<th field="mename" width="200" editor="text">mename</th>
				<th field="authid" width="200" editor="text">authid</th>
				<th field="parent" width="200" editor="text">parent</th>
			</tr>
		</thead>
	</table>
	
</body>
</html>